<?php

/**
 * This is the model class for table "budidayamaduprojek".
 *
 * The followings are the available columns in table 'budidayamaduprojek':
 * @property integer $bmp_id
 * @property integer $bmp_kec
 * @property integer $bmp_petani
 * @property integer $bmp_koloni
 * @property integer $bmp_pakan
 * @property integer $bmp_produksi
 * @property integer $bmp_tahun
 *
 * The followings are the available model relations:
 * @property Kecamatan $bmpKec
 */
class Budidayamaduprojek extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @return Budidayamaduprojek the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'budidayamaduprojek';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('bmp_kec, bmp_petani, bmp_koloni, bmp_pakan, bmp_produksi, bmp_tahun', 'numerical', 'integerOnly'=>true),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('bmp_id, bmp_kec, bmp_petani, bmp_koloni, bmp_pakan, bmp_produksi, bmp_tahun', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
			'bmpKec' => array(self::BELONGS_TO, 'Kecamatan', 'bmp_kec'),
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'bmp_id' => 'Bmp',
			'bmp_kec' => 'Bmp Kec',
			'bmp_petani' => 'Bmp Petani',
			'bmp_koloni' => 'Bmp Koloni',
			'bmp_pakan' => 'Bmp Pakan',
			'bmp_produksi' => 'Bmp Produksi',
			'bmp_tahun' => 'Bmp Tahun',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('bmp_id',$this->bmp_id);
		$criteria->compare('bmp_kec',$this->bmp_kec);
		$criteria->compare('bmp_petani',$this->bmp_petani);
		$criteria->compare('bmp_koloni',$this->bmp_koloni);
		$criteria->compare('bmp_pakan',$this->bmp_pakan);
		$criteria->compare('bmp_produksi',$this->bmp_produksi);
		$criteria->compare('bmp_tahun',$this->bmp_tahun);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}
}